<?php

include 'qrs.php';
if ($sqlNumCharRow>=1)
{

	$online=0;
	//select data from armory

	$name = $char;
	$sqlOffChar = mysqli_query($mysqli,"SELECT ch.level, cs.race, cs.class, cs.faction, ch.last_login, ch.points, ch.spec1, ch.spec2, ch.guild, ch.item_level, ch.char_history_id
	FROM char_summary cs LEFT OUTER JOIN char_history ch ON cs.char_id = ch.char_id
WHERE cs.name = '$char' AND cs.realm = '$realm' ORDER BY ch.last_login DESC LIMIT 0,1");


	$sqlOffCharResult = mysqli_fetch_row($sqlOffChar);
	$level = $sqlOffCharResult[0];
	$race = $sqlOffCharResult[1];
	$class = $sqlOffCharResult[2];
	$faction = $sqlOffCharResult[3];
	$lastLogin = $sqlOffCharResult[4];
	$points = $sqlOffCharResult[5];
	$talent1 = $sqlOffCharResult[6];
	$talent2 = $sqlOffCharResult[7];
	$guildName = $sqlOffCharResult[8];
	$itemLevel = $sqlOffCharResult[9];
	$charHist = $sqlOffCharResult[10];

	$sqlOffCharPro = mysqli_query($mysqli,"SELECT pro_name, pro_val, pro_max, type FROM char_history_pro WHERE char_history_id = '$charHist'");

	while ($profOffline = mysqli_fetch_array($sqlOffCharPro))
	{
		if ($profOffline[3]=='P')//profession
			{
			$prof[]=$profOffline[0];
			$profval[]=$profOffline[1];
			$profmax[]=$profOffline[2];
		}
		else if ($profOffline[3]=='S')//profession
				{
				$skill[]=$profOffline[0];
				$skillval[]=$profOffline[1];
				$skillmax[]=$profOffline[2];
			}
	}



	echo "<p>The armory is offline, but we've got your back</p>";
}//end character lookup
?>